﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Jb.Search.TextExtractor
{
    public class TextDocument : ITextExtractor
    {
        public TextDocument(String filePath)
        {
            this.FilePath = filePath;
        }
        /// <summary>
        /// File path to the corresponding document to extract from
        /// </summary>
        public string FilePath { get; set; }

        /// <summary>
        /// Extracts text from a Text File with .txt extension
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public String ExtractText()
        {
            if (File.Exists(FilePath))
                return File.ReadAllText(FilePath);

            return String.Empty;
        }
    }
}
